import request from "@/utils/request";

// 商品检索
export function search(data) {
  return request({
    url: "/product/search",
    method: "post",
    data,
  });
}

// 商品详情
export function getProductBySpu(spuId) {
  return request({
    url: `/product/info/${spuId}`,
    method: "get",
  });
}

// 商品库存信息
export function getProductStatsInfo(skuId) {
  return request({
    url: `/product/statsInfo/${skuId}`,
    method: "get",
  });
}

// 全文检索
export function searchByKeyword(params) {
  return request({
    url: `/es/match`,
    method: "get",
    params: params,
  });
}

// 商品收藏
export function collectProduct(spuId) {
  return request({
    url: `/product/collect/${spuId}`,
    method: "post",
  });
}

// 商品推荐
export function recommendProduct() {
  return request({
    url: "/product/recommend",
    method: "get",
  });
}
